using System;
using System.Collections.Generic;
using System.Text;

namespace Yorrick.FlickrMetadataSynchr.Local
{
    /// <summary>
    /// Exception type that is thrown when an errors occurs when reading or updating metadata
    /// on local pictures.
    /// </summary>
    [Serializable]
    public class LocalMetadataException : Exception
    {
        #region Private fields
        /// <summary>
        /// The file name of the picture whose metadata could not be read or updated.
        /// </summary>
        private string _fileName;
        #endregion

        #region Public properties
        /// <summary>
        /// Gets the file name of the picture whose metadata could not be read or updated.
        /// </summary>
        public string FileName
        {
            get
            {
                return _fileName;
            }
        }
        #endregion

        #region Constructors
        /// <summary>
        /// Constructs an instance.
        /// </summary>
        public LocalMetadataException()
        {
        }

        /// <summary>
        /// Constructs an instance with an error message.
        /// </summary>
        /// <param name="message">The error message.</param>
        public LocalMetadataException(string message)
            : base(message)
        {
        }

        /// <summary>
        /// Constructs an instance with an error message and an inner exception.
        /// </summary>
        /// <param name="message">The error message.</param>
        /// <param name="inner">The inner exception</param>
        public LocalMetadataException(string message, Exception inner)
            : base(message, inner)
        {
        }

        /// <summary>
        /// Constructs an instance with an error message and a filename.
        /// </summary>
        /// <param name="message">The error message.</param>
        /// <param name="fileName">The file name of the picture whose metadata could not be read or updated.</param>
        public LocalMetadataException(string message, string fileName)
            : this(message)
        {
            _fileName = fileName;
        }

        /// <summary>
        /// Constructs an instance with an error message, file name and an inner exception.
        /// </summary>
        /// <param name="message">The error message.</param>
        /// <param name="fileName">The file name of the picture whose metadata could not be read or updated.</param>
        /// <param name="inner">The inner exception</param>
        public LocalMetadataException(string message, string fileName, Exception inner)
            : this(message, inner)
        {
            _fileName = fileName;
        }

        /// <summary>
        /// Constructor for serialization purposes.
        /// </summary>
        /// <param name="info">The serialization info.</param>
        /// <param name="context">The serialization context.</param>
        protected LocalMetadataException(
         System.Runtime.Serialization.SerializationInfo info,
         System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
        }
        #endregion
    }
}
